package com.edu.compile.dto.api;

import com.alibaba.fastjson.JSON;
import com.edu.compile.dto.RequestParam;
import com.edu.model.constant.EventConstant;

public class ApiParam extends RequestParam<ApiParam> {

    /**
     * api地址
     */
    private String apiUrl;

    /**
     * 调用方法
     */
    private String method;

    /**
     * 编码，自定义时使用
     */
    private String encode = "utf-8";

    /**
     * 参数
     */
    private String params;

    /**
     * 请求类型
     */
//    private String contentType = EventConstant.ContentTypeConstant.JSON;
    private String contentType = EventConstant.ContentTypeConstant.FORM;

    @Override
    public ApiParam parse(String requestParam) {
        return JSON.parseObject(requestParam, ApiParam.class);
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getEncode() {
        return encode;
    }

    public void setEncode(String encode) {
        this.encode = encode;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }
}
